<?php
/*
 * This is next to p1.
 */
include '../include/config.php';
session_start();
$_SESSION['gender'] = $_POST['gender'];
$babyproductid = 2;
$buy = mysql_query("select * from salus_buy_detail where FK_fa_product_id = '" . $babyproductid . "' ") or die(mysql_error());
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Payment Process</title><link href="../include/css/fal_style.css" rel="stylesheet" type="text/css" /><script src="../include/js/jquery.js" type="text/javascript"></script><script src="../include/js/flash.js" type="text/javascript"></script><script src="../include/js/jquery-1.2.6.min.js" type="text/javascript"></script></head>
    <body>
        <div id="wrapper">
            <div id="header01"></div>



            <div id="mainContent">             

                <div class="content">

                    <center>
                        <h1>WELCOME TO PAYMENT PROCESS FOR </h1> &nbsp; <img src="../include/images/baby.png" height="70" width="200" /><br/>
                        <?php
                        if ($_POST['prapid'] == 'yes') {
                            $get_comp = mysql_query("select * from salus_company_list where id='" . $_POST['company_id'] . "'") or die(mysql_error());
                            ?>                        
                            <div>
                                You have purchased Pre-Paid code
                                <table border="0" >      
                                    <form method="post" action="pre_suc.php" >
                                        <?php while ($row = mysql_fetch_array($get_comp)) { ?>
                                            <tr>
                                                <td>Company Name :</td>
                                                <td><b><?= $row[1] ?></b></td>
                                            </tr>
                                            <tr>
                                                <td>Seller Name :</td>
                                                <td><b><?= $row[2] ?></b></td>
                                            </tr>   
                                            <tr>
                                                <td>Discount : </td>
                                                <td><b><?= $row[5] ?></b> %</td>
                                            </tr>                                        
                                            <tr>
                                                <td>Select Money You paid :</td>
                                                <td> &euro; <select name="paid" >
                                                        <?php
                                                        $dis = $row[5] / 100;
                                                        while ($row1 = mysql_fetch_array($buy)) {
                                                            $maincost = $row1[3];
                                                            $dis1 = $maincost * $dis;
                                                            $pad = $maincost - $dis1;
                                                            echo '<option value="' . $pad . '" >' . $pad . '</option>';
                                                        }
                                                        ?>
                                                    </select>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td></td>
                                                <td>
                                                    <input type="hidden" value="<?= $row[5] ?>" name="discount"/>
                                                    <input type="hidden" value="<?= $_POST['company_id'] ?>" name="company_id" />                                                    
                                                    <input type="submit" value="Create My Account" /> 

                                                </td>
                                            </tr>

                                        <?php } ?>
                                    </form>
                                </table>
                            </div>
                        <?php } else { ?>

                            <b>You are purchasing account directly from site.</b><br/><br/><br/>
                            <div style="width: 500px; margin-left: 200px; text-align: justify; border:2px coral solid; " >
                                <b>Description :</b><?php $detal = mysql_fetch_array(mysql_query("select detail from salus_buy_detail where FK_fa_product_id = $babyproductid ")); ?>
                                <?= $detal[0] ?><br/><br/>
                                <form action="pay.php" method="post" >
                                    <b>Choose your subscription :</b>
                                    <select name="purchase" >
                                        <?php
                                        $q1 = mysql_query("select * from salus_buy_detail where FK_fa_product_id = $babyproductid ") or die(mysql_error());
                                        while ($row2 = mysql_fetch_array($q1)) {
                                            ?>
                                            <option value="<?= $row2[3] ?>" style="height: 20px;"  ><?= $row2[2] ?> @ <?= $row2[3] ?>$</option>                                                                                
                                        <?php } ?>
                                    </select><br/><br/>                                   
                                    <center><input type="submit" value="Proceed To Next Step"/></center>
                                </form>
                            <?php } ?>
                        </div>
                    </center>



                    <div class="clear"></div>
                </div><!--END INCLUDED CONTENT-->
                <div class="clear"></div>                
            </div>
        </div> 
    </body>
</html> 
